package org.example.studentmanager.repository;

import org.example.studentmanager.model.Student;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface StudentRepository extends JpaRepository<Student, Long> {
    // 根据姓名搜索学生
    List<Student> findByNameContaining(String name);

    // 根据院系搜索学生
    List<Student> findByDepartment(String department);

    // 分页查询所有学生
    Page<Student> findAll(Pageable pageable);

    // 分页根据姓名搜索学生
    Page<Student> findByNameContaining(String name, Pageable pageable);
}